<?php

require ("sharedResources.php");

$sid = '';
try {
    // We need a SID (session ID) in order to operate
	$sid = login ( 'admin', 'admin' );
	echo 'sid: ' . $sid . PHP_EOL;
	
	// Search using a specific tag
	$tag = 'english';
	$searchParams = array ('sid' => $sid, 'tag' => $tag );
	
	$result = $searchClient->findByTag ( $searchParams );
	print_r ( $result );
	
	if (!empty($result->document)) {
	   echo "Documents found with tag: '$tag' : ".count($result->document);
	} else {
	   echo "No Documents found with the given tag: '$tag'";
  }
	//unset ( $folderClient );
} catch ( SoapFault $e ) {
	print_r ( $e );
}

// Always we need to logout in order to release connection slot
logout ( $sid );
?> 
